import { createApp } from 'vue';
import { useRegisterSW } from 'virtual:pwa-register/vue';
import { components, plugins } from './components';
import App from './App.vue';
import store from './stores';
import router from './router';
import i18n from './locales';
import '@/router/permission';
import 'virtual:svg-icons-register';

// css
import '@/styles/tailwind.css';

useRegisterSW();

const app = createApp(App);
app.use(store);
app.use(router);
app.use(i18n);
app.mount('#app');

// 加载全局组件
components.forEach((component) => {
  app.component(component.name, component);
});

// 加载全局插件
plugins.forEach((plugin) => {
  app.use(plugin);
});
